package com.project.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.StudentBean;
import com.project.mapper.IStudentMapper;
import com.project.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author liuyulai
 * Created with IntelliJ IDEA.
 * Date: 21.7.11
 * Time: 16:14
 * Description: No Description
 */
@Service
@Transactional
public class StudentServiceImpl implements IStudentService {
    @Autowired
    private IStudentMapper iStudentMapper;

    @Override
    public PageInfo<StudentBean> showStudentByItem(int pageNo, String stuName, String schoolName) {
        PageHelper.startPage(pageNo, 3);
        PageInfo<StudentBean> info = PageInfo.of(iStudentMapper.showStudentByItem(stuName, schoolName));
        return info;
    }

    @Override
    public void addNewStudent(StudentBean studentBean) {
        iStudentMapper.addNewStudent(studentBean);
    }

    @Override
    public StudentBean showStudentById(int studentId) {
        return iStudentMapper.showStudentById(studentId);
    }

    @Override
    public void updateStudentInfo(int stuId, int classesId, String tel) {
        iStudentMapper.updateStudentInfo(stuId, classesId, tel);
    }

    @Override
    public void delStudent(int stuId) {
        iStudentMapper.delStudent(stuId);
    }
}
